/**
 * 
 * 起迪科技 Copyright (c) 2014-2018 QiDi,Inc.All Rights Reserved.
 */
package cn.qidisoft.edu.hzjt.service.impl;

import java.util.List;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.qidisoft.core.common.code.QdfRespCode;
import cn.qidisoft.core.common.exception.dao.DBException;
import cn.qidisoft.core.common.log.LoggerAdapter;
import cn.qidisoft.core.common.log.LoggerAdapterFactory;
import cn.qidisoft.edu.hzjt.dao.JkyContributionReplyMapper;
import cn.qidisoft.edu.hzjt.model.JkyContributionReply;
import cn.qidisoft.edu.hzjt.service.IJkyContributionReplyService;
import cn.qidisoft.edu.hzjt.utils.LogType;

/**
 * 
 * @author hxq
 * @version $Id: JkyContributionReplyServiceImpl.java, v 0.1 2018年12月6日 上午10:45:40 hxq Exp $
 */
@Service("jkyContributionReplyService")
public class JkyContributionReplyServiceImpl implements IJkyContributionReplyService {
  protected static final LoggerAdapter LOGGER =
      LoggerAdapterFactory.getLogger(LogType.HZJT_LOGGER.val);
  @Autowired
  private JkyContributionReplyMapper jkyContributionReplyMapper;

  /**
   * @see cn.qidisoft.edu.hzjt.service.IJkyContributionReplyService#deleteByPK(java.lang.Integer)
   */
  @Override
  @Transactional
  public int deleteByPK(Integer rid) {
    return 0;
  }

  /**
   * @see cn.qidisoft.edu.hzjt.service.IJkyContributionReplyService#insert(cn.qidisoft.edu.hzjt.model.JkyContributionReply)
   */
  @Override
  @Transactional
  public int insert(JkyContributionReply record) {
    try {
      jkyContributionReplyMapper.insert(record);
      return record.getRid();
    } catch (Exception e) {
      e.printStackTrace();
      LOGGER.error("insert [{}] error," + this.getClass().getName() + "=[{}]",
          this.getClass().getName(),
          ToStringBuilder.reflectionToString(record, ToStringStyle.SHORT_PREFIX_STYLE));
      throw new DBException(QdfRespCode.QDF_020002.getCode(), QdfRespCode.QDF_020002.getMsg(), e);
    }
  }

  /**
   * @see cn.qidisoft.edu.hzjt.service.IJkyContributionReplyService#queryByPK(java.lang.Integer)
   */
  @Override
  public JkyContributionReply queryByPK(Integer rid) {
    return null;
  }

  /**
   * @see cn.qidisoft.edu.hzjt.service.IJkyContributionReplyService#updateByPK(cn.qidisoft.edu.hzjt.model.JkyContributionReply)
   */
  @Override
  @Transactional
  public int updateByPK(JkyContributionReply record) {
    return 0;
  }

  /**
   * @see cn.qidisoft.edu.hzjt.service.IJkyContributionReplyService#queryContributionReplyList(java.lang.Integer)
   */
  @Override
  public List<JkyContributionReply> queryContributionReplyList(Integer tgid) {
    try {
      JkyContributionReply paramObj = new JkyContributionReply();
      paramObj.setParentid(tgid);
      return jkyContributionReplyMapper.queryContributionReplyList(paramObj);
    } catch (Exception e) {
      e.printStackTrace();
      LOGGER.error("queryContributionReplyList [{}] error," + this.getClass().getName() + "=[{}]",
          this.getClass().getName(),
          ToStringBuilder.reflectionToString(tgid, ToStringStyle.SHORT_PREFIX_STYLE));
      throw new DBException(QdfRespCode.QDF_020002.getCode(), QdfRespCode.QDF_020002.getMsg(), e);
    }
  }

}
